#pragma once

#include <string>

namespace Putin{

typedef unsigned short USHORT;



class NetworkPacket
{
public:

	virtual int getType(){ return NetworkPacket::npUnknown;};

	enum NetPacket
	{
		npUnknown = 0,
		npCommand,
		npText
	};
};

// Some default commands. 
// Its free to create new ones
#define NC_FRAME	10		// Frame Ack
#define NC_GO		20		// Start Game
#define NC_MOVE		30		// Move unit
#define NC_ATTACK	40		// Attack target
#define NC_STOP		50		// Stop 
#define NC_HIT		60		// Hit target
#define NC_KILL		70		// Killed target
#define NC_SPAWN	80		// Spawn unit
#define NC_PLAYER	90		// Player info
#define NC_PLAYER_R 91		// player reply info ( you are player x)
#define NC_PLAYER_D	92		// player disconnected

/*!
 * \brief Network command structure. This is pretty generic
 */
class NetworkCommand : public NetworkPacket
{
public:

	NetworkCommand(USHORT command, USHORT id1, USHORT id2, float x, float y)
	{
		this->command = command;
		this->id1 = id1;
		this->id2 = id2;
		this->x = x;
		this->y = y;
	}
	virtual int getType(){ return NetworkPacket::npCommand;};

	USHORT	command;
	USHORT	id1;
	USHORT	id2;
	float	x;
	float	y;
};


/*!
 * \brief Network text message with 2 short int IDs.
 */
class NetworkText : public NetworkPacket
{
public:
	
	NetworkText(USHORT id1, USHORT id2, std::string text)
	{
		this->id1 = id1;
		this->id2 = id2;
		this->text = text;
	}
	virtual int getType(){ return NetworkPacket::npText;};

	USHORT			id1;
	USHORT			id2;
	std::string		text;
};


}